<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        
        li {
            list-style: none;
        }
        
        .title {
            width: 80px;
            margin-left: 20px;
        }
        
        .title-td {
            display: inline-block;
            width: 76px;
            height: 40px;
            border: 1px solid #FCFCFC;
            text-decoration: none;
            color: #4C4C4C;
            text-align: center;
            line-height: 40px;
            font-size: 14px;
        }
        
        .title-td:after {
            content: "";
            display: inline-block;
            width: 8px;
            height: 5px;
            background: url(images/icon.png) 0 -977px no-repeat;
            vertical-align: middle;
            margin-left: 10px;
        }
        
        .title-bd {
            display: none;
            width: 78px;
            box-shadow: 3px 3px 3px rgba(0, 0, 0, .1);
        }
        
        .title-bd li {
            width: 76px;
            height: 30px;
            border: 1px solid #EBBE7A;
            border-top: 0;
        }
        
        .title-bd li a {
            display: block;
            width: 100%;
            height: 100%;
            color: #4C4C4C;
            text-align: center;
            line-height: 30px;
            text-decoration: none;
            font-size: 14px;
        }
    </style>
</head>

<body>
    <div class="title">
        <a href="#" class="title-td"><em>微博</em></a>
        <div class="title-bd">
            <ul>
                <li><a href="#">私信</a></li>
                <li><a href="#">评论</a></li>
                <li><a href="#">@我</a></li>
            </ul>
        </div>
    </div>
    <script>
        //获取元素
        var title = document.querySelector('.title')
        var td = document.querySelector('.title-td');
        var bd = document.querySelector('.title-bd');
        var lis = document.querySelectorAll('li');
        console.log(lis);

        //注册事件
        title.onmouseover = function() {
            td.style.backgroundColor = '#ccc';
            td.style.color = '#ff8400';
            bd.style.display = 'block';
        }
        title.onmouseout = function() {
            td.style.backgroundColor = '';
            td.style.color = '#4C4C4C';
            bd.style.display = 'none';
        }
        for (i = 0; i < lis.length; i++) {
            lis[i].onmouseover = function() {
                this.style.color = '#ff8400';
                this.style.backgroundColor = '#fff5da';
            }
            lis[i].onmouseout = function() {
                this.style.color = '#4C4C4C';
                this.style.backgroundColor = '';
            }
        }
    </script>
</body>

</html>